#
# 制作自己的镜像
#  docker build -t chancelau/blog-web:latest .
# 推送到DockerHub
# docker push chancelau/blog-web:latest
# ---------
# 环境版本
FROM anapsix/alpine-java:8_server-jre_unlimited
LABEL maintainer="chancelau<chancelau@hotmail.com>"

# JVM调优参数等额外参数
ENV PARAMS ""
ENV TZ=PRC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# ---------

#FROM alpine:3.4
#LABEL maintainer="liu yong chang <icmilyc@163.com>"
## A few problems with compiling Java from source:
##  1. Oracle.  Licensing prevents us from redistributing the official JDK.
##  2. Compiling OpenJDK also requires the JDK to be installed, and it gets
##       really hairy.
#
## Default to UTF-8 file.encoding
#ENV LANG C.UTF-8
#
## add a simple script that can auto-detect the appropriate JAVA_HOME value
## based on whether the JDK or only the JRE is installed
#RUN { \
#		echo '#!/bin/sh'; \
#		echo 'set -e'; \
#		echo; \
#		echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
#	} > /usr/local/bin/docker-java-home \
#	&& chmod +x /usr/local/bin/docker-java-home
#ENV JAVA_HOME /usr/lib/jvm/java-1.8-openjdk/jre
#ENV PATH $PATH:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin
#
#ENV JAVA_VERSION 8u111
#ENV JAVA_ALPINE_VERSION 8.111.14-r0
#
#RUN set -x \
#	&& apk add --no-cache \
#		openjdk8-jre="$JAVA_ALPINE_VERSION" \
#	&& [ "$JAVA_HOME" = "$(docker-java-home)" ]





# 指定容器端口
EXPOSE 8085

# 添加本地 JAR 到容器内
ADD target/blog-web.jar app.jar

# 容器启动后执行的命令
ENTRYPOINT ["java", "-jar","app.jar" , "-Djava.security.egd=file:/dev/./urandom","$PARAMS"]
